const TABLENAME = "user_table"
const getusertable =  (connection,fn) => {
    connection.connect((err) => {
        if (err) {
            console.log('worng', err) // 连接出错
            throw err
            return
        }
        console.log('连接成功')
        connection.query('SELECT * FROM ' + TABLENAME, (err, rows) => {
            if (err) {
                console.log('查询表' + TABLENAME + '出错');
                throw err
                return
            };
            console.log('查询表' + TABLENAME + '成功');
            console.log(rows)
            rows
            fn(rows)
        })
    })
}
module.exports = getusertable